package com.ycw.servlet.wangwang;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.alibaba.fastjson.JSON;
import com.ycw.dao.ContractDao;
import com.ycw.dao.impl.ContractDaoImpl;
import com.ycw.pojo.Contract;

@WebServlet("/doGetAllByScnoServlet")
public class doGetOneByIdServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;

	@Override
	protected void service(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		ContractDao cd = new ContractDaoImpl();
		String cid = request.getParameter("c_id");
		int c_id = Integer.parseInt(cid);

		Contract contract = new Contract();
		contract.setC_id(c_id);
		Contract resMap = cd.getAllByScno(contract);

		String resJSON = JSON.toJSONString(resMap);
		PrintWriter out = response.getWriter();
		out.write(resJSON);
		out.close();
	}

}
